package user

import (
	"context"
	"gorm.io/gorm"
)

type CommonUserDataRepoIface interface {
	//获取用户+绑定详情
	GetInfoWithBind(ctx context.Context, condition map[string]interface{}) (*CommonUserInfoBo, error)
	// 通过账号密码获取用户
	GetInfoByAccountAndPassword(ctx context.Context, tenantCode, account, password string, isNeedMd5 bool) (*CommonUserInfoBo, error)
	GetInfoByUid(ctx context.Context, uid string) (*CommonUserInfoBo, error)
	GetInfoLeftJoinBind(ctx context.Context, condition map[string]interface{}) (*CommonUserInfoBo, error)
	// 获取详情
	GetInfo(ctx context.Context, condition map[string]interface{}, orderBy string) (*CommonUserData, error)
	GetInfoByAccount(ctx context.Context, tenantCode, account string) (*CommonUserInfoBo, error)
	//获取列表数据
	GetList(ctx context.Context, condition map[string]interface{}, page, pagesize int, orderBy string) (int64, []*CommonUserData, error)
	//更新数据
	Update(ctx context.Context, data, condition map[string]interface{}) (bool, error)
	PersonalUserToTenantRecordWrite(ctx context.Context, commonPersonalUserToTenantRecordPo *CommonPersonalUserToTenantRecordPo) error
	//插入数据
	Insert(ctx context.Context, commonUserData *CommonUserData) (bool, error)
	//逻辑删除数据
	Delete(ctx context.Context, condition map[string]interface{}) (bool, error)
	//获取用户信息
	GetUserIno(ctx context.Context, condition map[string]interface{}) (*CommonUserData, error)
	GetUserActionRightInfos(ctx context.Context, condition map[string]interface{}) ([]*CommonUserActionRightInfos, error)
	GetUserRoleRelation(ctx context.Context, condition map[string]interface{}) ([]*CommonUserRoleRelation, error)
	CreateUserActionRightInfos(ctx context.Context, tx *gorm.DB, commonUserActionRightInfos []*CommonUserActionRightInfos) error
	DelUserActionRightInfos(ctx context.Context, tx *gorm.DB, tenantCode string, tenantUserUid string) error
	DelUserRoleRelation(ctx context.Context, tx *gorm.DB, tenantCode string) error
	GetUserInfoByMobileAndNotTenantCode(ctx context.Context, mobile string, orderBy string) (*CommonUserData, error)
	GetUserInfoByMobileNoPay(ctx context.Context, mobile string, orderBy string) (*CommonUserData, error)

	CreateUserRoleRelation(ctx context.Context, tx *gorm.DB, commonUserRoleRelation []*CommonUserRoleRelation) error
}
